<template>
  <div class="lg:flex">
    <Avatar :src="userinfo.imageUrl || headerImg" :size="72" class="!mx-auto !block" />
    <div class="md:ml-6 flex flex-col justify-center md:mt-0 mt-2">
      <h1 class="md:text-lg text-md">早安, {{ userinfo.realName }}, 开始您一天的工作吧！</h1>
    </div>
    <div class="flex flex-1 justify-end md:mt-0 mt-4">
      <div class="flex flex-col justify-center text-right md:mr-10 mr-4">
        <span class="text-secondary"> 待处理 </span>
        <span class="text-2xl"><a href="/#/work/work-todo">{{ summaryData.count1 }}</a></span>
      </div>

      <div class="flex flex-col justify-center text-right md:mr-10 mr-4">
        <span class="text-secondary"> 已处理 </span>
        <span class="text-2xl"><a href="/#/work/work-done">{{ summaryData.count2 }}</a></span>
      </div>

      <div class="flex flex-col justify-center text-right md:mr-10 mr-4">
        <span class="text-secondary"> 抄送 </span>
        <span class="text-2xl"><a href="/#/work/work-cc">{{ summaryData.count3 }}</a></span>
      </div>

    </div>
  </div>
</template>
<script lang="ts">
import { computed, defineComponent, ref, } from 'vue';
import { Avatar } from 'ant-design-vue';
import { useUserStore } from '/@/store/modules/user';
import headerImg from '/@/assets/images/header.jpg';

import { getSummary } from '/@/api/work/work';

export default defineComponent({
  components: { Avatar },
  setup() {

    const summaryData = ref ({
      count1: 0,
      count2: 0,
      count3: 0,
    });
    // 头像
    const userStore = useUserStore();
    const userinfo = computed(() => userStore.getUserInfo);


    getSummary().then(res => {
      console.log('获取【首页待办事项】数据成功', res)
      summaryData.value = res
    })


    return { summaryData, userinfo, headerImg, };
  },
});
</script>
